﻿package com.mui.controls
{
    import __AS3__.vec.*;
    import com.gengine.core.*;
    import com.gengine.global.*;
    import com.mui.manager.*;
    import com.mui.utils.*;
    import fl.controls.listClasses.*;
    import flash.display.*;
    import flash.events.*;

    public class GCellRenderer extends CellRenderer implements ICellRenderer, IToolTipItem, IFrUIContainer
    {
        private var _uiDisposeVec:Vector.<IDispose>;
        protected var _disposed:Boolean = true;
        private var _toolTipData:Object;
        private var _reactionTime:int = 500;

        public function GCellRenderer()
        {
            this._uiDisposeVec = new Vector.<IDispose>;
            super.configUI();
            this.initSkin();
            this.tabChildren = false;
            this.addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStageHandler);
            return;
        }// end function

        protected function initSkin() : void
        {
            var _loc_1:* = new Bitmap();
            this.setStyle("downSkin", _loc_1);
            this.setStyle("overSkin", _loc_1);
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", _loc_1);
            this.setStyle("selectedOverSkin", _loc_1);
            this.setStyle("selectedUpSkin", _loc_1);
            return;
        }// end function

        protected function judgeToolTip(event:Event = null) : void
        {
            if (event && event.type == Event.ADDED_TO_STAGE && this.toolTipData || !event && this.toolTipData && Global.stage.contains(this))
            {
                ToolTipsManager.register(this);
            }
            else
            {
                ToolTipsManager.unregister(this);
            }
            return;
        }// end function

        protected function onAddedToStageHandler(event:Event) : void
        {
            this.removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStageHandler);
            this.mouseChildren = true;
            this.mouseEnabled = true;
            return;
        }// end function

        override public function set listData(param1:ListData) : void
        {
            _listData = param1;
            label = _listData.label;
            setStyle("icon", _listData.icon);
            return;
        }// end function

        override public function get selected() : Boolean
        {
            return _selected;
        }// end function

        override public function set selected(param1:Boolean) : void
        {
            super.selected = param1;
            return;
        }// end function

        public function get toolTipData()
        {
            return this._toolTipData;
        }// end function

        public function set toolTipData(param1) : void
        {
            this._toolTipData = param1;
            this.judgeToolTip();
            return;
        }// end function

        public function get reactionTime() : int
        {
            return this._reactionTime;
        }// end function

        public function set reactionTime(param1:int) : void
        {
            this._reactionTime = param1;
            return;
        }// end function

        protected function pushUIToDisposeVec(param1:IDispose) : void
        {
            this._uiDisposeVec.push(param1);
            return;
        }// end function

        protected function onAddToStageCreate(event:Event) : void
        {
            this.createDisposedChildren();
            return;
        }// end function

        protected function onRemoveFromStageDispose(event:Event) : void
        {
            this.disposeChildren();
            return;
        }// end function

        public function configEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
        {
            ObjEventListerTool.addObjEvent(this, param1, param2, param3);
            addEventListener(param1, param2, param3, param4, param5);
            return;
        }// end function

        public function set isDisposed(param1:Boolean) : void
        {
            return;
        }// end function

        override public function removeEventListener(param1:String, param2:Function, param3:Boolean = false) : void
        {
            ObjEventListerTool.removeObjEvent(this, param1, param2, param3);
            super.removeEventListener(param1, param2, param3);
            return;
        }// end function

        public function get isDisposed() : Boolean
        {
            return this._disposed;
        }// end function

        public function dispose(param1:Boolean = true) : void
        {
            this.disposeChildren();
            ObjEventListerTool.delObjEvent(this);
            if (this.parent)
            {
                this.parent.removeChild(this);
            }
            if (param1)
            {
                UICompomentPool.disposeUICompoment(this);
            }
            this._reactionTime = 500;
            return;
        }// end function

        protected function disposeChildren(param1:Boolean = true) : void
        {
            var _loc_2:IDispose = null;
            if (!this._disposed)
            {
                this._disposed = true;
                for each (_loc_2 in this._uiDisposeVec)
                {
                    
                    _loc_2.dispose(param1);
                }
                this._uiDisposeVec = new Vector.<IDispose>;
                this.disposeImpl(param1);
            }
            return;
        }// end function

        public function createDisposedChildren() : void
        {
            if (!this._disposed)
            {
                return;
            }
            this._disposed = false;
            this.createDisposedChildrenImpl();
            return;
        }// end function

        protected function disposeImpl(param1:Boolean = true) : void
        {
            return;
        }// end function

        protected function createDisposedChildrenImpl() : void
        {
            return;
        }// end function

    }
}
